package cn.cs.service;

import cn.cs.mapper.UserCompanyMapper;
import cn.cs.pojo.UserCompany;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
public class UserCompanyService {

    @Resource
    private UserCompanyMapper userCompanyMapper;

    @RequestMapping(value = "/getUserCompanyById", method = RequestMethod.POST)
    public UserCompany getUserCompanyById(@RequestParam("id") String id) throws Exception{
        return userCompanyMapper.getUserCompanyById(id);
    }

    @RequestMapping(value = "/getUserCompanyListByMap", method = RequestMethod.POST)
    public List<UserCompany> getUserCompanyListByMap(@RequestBody Map<String, Object> param) throws Exception{
        return userCompanyMapper.getUserCompanyListByMap(param);
    }

    @RequestMapping(value = "/getUserCompanyCountByMap", method = RequestMethod.POST)
    public Integer getUserCompanyCountByMap(@RequestBody Map<String, Object> param) throws Exception{
        return userCompanyMapper.getUserCompanyCountByMap(param);
    }

    @RequestMapping(value = "/addUserCompany", method = RequestMethod.POST)
    public Integer addUserCompany(@RequestBody UserCompany userCompany) throws Exception{
        return userCompanyMapper.insertUserCompany(userCompany);
    }

    @RequestMapping(value = "/modifyUserCompany", method = RequestMethod.POST)
    public Integer modifyUserCompany(@RequestBody UserCompany userCompany) throws Exception{
        return userCompanyMapper.updateUserCompany(userCompany);
    }

    @RequestMapping(value = "/deleteUserCompanyById", method = RequestMethod.POST)
    public Integer deleteUserCompanyById(@RequestParam("id") String id) throws Exception{
        return userCompanyMapper.deleteUserCompanyById(id);
    }

    @RequestMapping(value = "/updateCompanyTypeId", method = RequestMethod.POST)
    public Integer updateCompanyTypeId(@RequestParam("id") String id) throws Exception{
        return userCompanyMapper.updateCompanyTypeId(id);
    }

}
